<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 10rem;
        }
    </style>
</head>

<body>
    <div>

    </div>
    rem
    <script>
        var vw = window.innerWidth;
        var rem = vw / 10;
        var root = document.getElementsByTagName('html')[0];
        root.style.fontSize = rem + "px";
        window.onresize = function () {
            var vw = window.innerWidth;
            root.style.fontSize = vw / 10 + "px";
        }
    </script>
</body>

</html>